# -*- coding: utf-8 -*-
import socket
from abc import ABC, abstractmethod


class IConnection(ABC):
    @abstractmethod
    def Start(self):
        """
        启动链接 让当前的链接准备开始工作
        :return:
        """
        pass

    @abstractmethod
    def Stop(self):
        """
        停止链接 结束当前链接的工作
        :return:
        """
        pass

    @abstractmethod
    def GetConnID(self) -> int:
        """
        获取当前链接模块的链接ID
        :return:
        """
        pass

    @abstractmethod
    def GetTCPConnection(self) -> socket.socket:
        """
        获取当前链接绑定的socket conn
        :return:
        """
        pass

    @abstractmethod
    def GetRemoteAddr(self) -> tuple:
        """
        获取远程客户端的TCP状态 IP Port
        :return:
        """
        pass

    @abstractmethod
    def SendMsg(self, msgID: int, data: bytes):
        """
        发送数据 将数据发送给远程的客户端
        :param msgID:
        :param data:
        :return:
        """
        pass

    @abstractmethod
    def SetProperty(self, key: str, value: object):
        """
        设置链接属性
        :param key:
        :param value:
        :return:
        """
        pass

    @abstractmethod
    def GetProperty(self, key: str) -> object:
        """
        获取链接属性
        :param key:
        :param value:
        :return:
        """
        pass

    @abstractmethod
    def RemoveProperty(self, key: str):
        """
        移除链接属性
        :param key:
        :param value:
        :return:
        """
        pass